package com.doctcloud.hisinfo.common.controller;

import com.doctcloud.common.core.domain.R;
import com.doctcloud.hisinfo.common.request.PriceListParam;
import com.doctcloud.hisinfo.common.service.impl.PriceListService;
import com.doctcloud.hisinfo.histable.domain.comm.PriceListDo;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.List;

@RestController
@RequestMapping(value = "/comm/")
public class PriceListController {
    @Autowired
    private PriceListService priceListService;
    @PostMapping("/pricelist/lastpriceitem")
    public PriceListDo lastPriceByItem(@RequestBody PriceListParam param){
        return priceListService.getPriceListLast(param);
    }
    @GetMapping("/pricelist/beforepricelist/{startDate}")
    public R<List<PriceListDo>> beforePriceListByDate(@PathVariable Date startDate){
        return R.ok(priceListService.listPriceListBeforeDate(startDate));
    };
    @GetMapping("/pricelist/listall")
    public R<List<PriceListDo>> listAll(){
        return R.ok(priceListService.dblistAll());
    }
}
